﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DataSourceMetadata"
    targetNamespace="DataSourceMetadata.xsd"
    elementFormDefault="qualified"
    xmlns="DataSourceMetadata.xsd"
    xmlns:mstns="DataSourceMetadata.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
  <xs:element name="Meta">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Info" type="mstns:DataSourceInfo" minOccurs="1" maxOccurs="1" />
        <xs:element name="Classes" type="mstns:MetaClasses" minOccurs="1" maxOccurs="1" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:complexType name="DataSourceInfo">
    <xs:sequence>
      <xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="Description" type="xs:string" minOccurs="0" maxOccurs="1" />
      <xs:element name="Author" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="Version" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="License" type="xs:string" minOccurs="1" maxOccurs="1" />
      <xs:element name="eMail" type="mstns:emailAddress" minOccurs="1" maxOccurs="1" />
      <xs:element name="Web" type="xs:anyURI" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="MetaClasses">
    <xs:sequence>
      <xs:element name="AddClass" type="mstns:MetaClass" minOccurs="1" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="MetaClass">
    <xs:sequence>
      <xs:element name="Filter" type="mstns:MetaClassFilters" minOccurs="1" maxOccurs="1" />
    </xs:sequence>
    <xs:attribute name="Name" type="xs:string" use="required" form="unqualified" />
    <xs:attribute name="Description" type="xs:string" use="optional" form="unqualified"/>    
  </xs:complexType>
  <xs:complexType name="MetaClassFilters">
    <xs:sequence>
      <xs:element name="AddFilter" type="mstns:MetaClassFilter" minOccurs="0" maxOccurs="unbounded" />
    </xs:sequence>
  </xs:complexType>
  <xs:complexType name="MetaClassFilter">
    <xs:attribute name="Name" type="xs:string" use="required" />
    <xs:attribute name="Desciption" type="xs:string" use="optional" />
  </xs:complexType>
  <xs:simpleType name="emailAddress">
    <xs:restriction base="xs:string">
      <xs:pattern value="[^@]+@[^\.]+\..+"/>
    </xs:restriction>
  </xs:simpleType>
</xs:schema>
